home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / FLTK-1.0.6 / configure.in < prev    next >
Encoding:
Text File  |  1999-08-09  |  7.0 KB  |  252 lines

  1. dnl# -*- sh -*-
  2. dnl# the "configure" script is made from this by running GNU "autoconf"
  3. dnl#
  4. dnl# "$Id: configure.in,v 1.33.2.5 1999/08/09 13:35:04 mike Exp $"
  5. dnl#
  6. dnl# Configuration script for the Fast Light Tool Kit (FLTK).
  7. dnl#
  8. dnl# Copyright 1998-1999 by Bill Spitzak and others.
  9. dnl#
  10. dnl# This library is free software; you can redistribute it and/or
  11. dnl# modify it under the terms of the GNU Library General Public
  12. dnl# License as published by the Free Software Foundation; either
  13. dnl# version 2 of the License, or (at your option) any later version.
  14. dnl#
  15. dnl# This library is distributed in the hope that it will be useful,
  16. dnl# but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. dnl# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18. dnl# Library General Public License for more details.
  19. dnl#
  20. dnl# You should have received a copy of the GNU Library General Public
  21. dnl# License along with this library; if not, write to the Free Software
  22. dnl# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  23. dnl# USA.
  24. dnl#
  25. dnl# Please report all bugs and problems to "fltk-bugs@easysw.com".
  26. dnl#
  27.  
  28. AC_INIT(src/Fl.cxx)
  29.  
  30. AC_PROG_RANLIB
  31.  
  32. LIBNAME="libfltk.a"
  33. if test "$RANLIB" != ":"; then
  34.   LIBCOMMAND="ar cr"
  35. else
  36.   LIBCOMMAND="ar crs"
  37. fi
  38. DSOCOMMAND="echo"
  39. DSONAME=""
  40.  
  41. dnl# Get the operating system and version number...
  42.  
  43. uname=`uname`
  44. uversion=`uname -r | sed -e '1,$s/[[-.A-Za-z]]//g'`
  45. if test "$uname" = "IRIX64"; then
  46.     uname="IRIX"
  47. fi
  48.  
  49. dnl# Clear debugging flags and only enable debugging if the user asks for
  50. dnl# it.
  51.  
  52. DEBUGFLAG=""
  53. PICFLAG=0
  54. CFLAGS="${CFLAGS:=}"
  55. CXXFLAGS="${CXXFLAGS:=}"
  56.  
  57. AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]],[if eval "test x$enable_debug = xyes"; then
  58.   DEBUGFLAG="-g "
  59. fi])
  60. AC_ARG_ENABLE(shared, [  --enable-shared         turn on shared libraries [default=no]],[
  61. if eval "test x$enable_shared = xyes"; then
  62.   PICFLAG=1
  63.   case $uname in
  64.       SunOS* | UNIX_S*)
  65.           DSONAME="libfltk.so.1"
  66.       DSOCOMMAND="\$(CXX) -Wl,-h,libfltk.so.1 \$(LDLIBS) -G $DEBUGFLAG -o"
  67.       ;;
  68.       HP-UX*)
  69.           DSONAME="libfltk.sl.1"
  70.       DSOCOMMAND="ld -b -z +h libfltk.sl.1 $DEBUGFLAG -o"
  71.       ;;
  72.       OSF1*)
  73.           DSONAME="libfltk.so.1"
  74.           DSOCOMMAND="\$(CXX) -Wl,-soname,libfltk.so.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
  75.       ;;
  76.       IRIX*)
  77.           DSONAME="libfltk.so.1"
  78.           DSOCOMMAND="\$(CXX) -soname libfltk.so.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
  79.       ;;
  80.       *)
  81.           echo "Warning: shared libraries may not be supported.  Trying -shared"
  82.       echo "         option with compiler."
  83.           DSONAME="libfltk.so.1"
  84.           DSOCOMMAND="\$(CXX) -Wl,-soname,libfltk.so.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
  85.       ;;
  86.   esac
  87. fi])
  88.  
  89. AC_PROG_CC
  90. AC_PROG_CXX
  91. dnl# AC_PROG_INSTALL
  92.  
  93. AC_C_BIGENDIAN
  94.  
  95. AC_CHECK_SIZEOF(short, 2)
  96. AC_CHECK_SIZEOF(int, 4)
  97. AC_CHECK_SIZEOF(long, 4)
  98. if test $ac_cv_sizeof_short -eq 2; then
  99.     AC_DEFINE(U16,unsigned short)
  100. fi
  101. if test $ac_cv_sizeof_int -eq 4; then
  102.     AC_DEFINE(U32,unsigned)
  103. else
  104.     if test $ac_cv_sizeof_long -eq 4; then
  105.         AC_DEFINE(U32,unsigned long)
  106.     fi
  107. fi
  108. if test $ac_cv_sizeof_int -eq 8; then
  109.     AC_DEFINE(U64,unsigned)
  110. else
  111.     if test $ac_cv_sizeof_long -eq 8; then
  112.         AC_DEFINE(U64,unsigned long)
  113.     fi
  114. fi
  115.  
  116. AC_HEADER_DIRENT
  117. AC_CHECK_HEADER(sys/select.h)
  118. AC_CHECK_FUNC(scandir,
  119.     if test "$uname" = "SunOS"; then
  120.     echo Not using Solaris scandir BSD emulation function.
  121.     else
  122.         AC_DEFINE(HAVE_SCANDIR)
  123.     fi)
  124. AC_CHECK_FUNC(vsnprintf,
  125.     if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
  126.     echo Not using built-in vsnprintf function because you are running HP-UX 10.20.
  127.     else
  128.         AC_DEFINE(HAVE_VSNPRINTF)
  129.     fi)
  130. AC_CHECK_FUNC(snprintf,
  131.     if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
  132.     echo Not using built-in snprintf function because you are running HP-UX 10.20.
  133.     else
  134.         AC_DEFINE(HAVE_SNPRINTF)
  135.     fi)
  136. AC_CHECK_FUNCS(vsprintf)
  137.  
  138. AC_PATH_XTRA
  139. echo "Ignoring libraries \"$X_PRE_LIBS\" requested by configure."
  140. dnl# LIBS="$LIBS$X_LIBS$X_PRE_LIBS"
  141. LIBS="$LIBS$X_LIBS"
  142. CFLAGS="$CFLAGS $X_CFLAGS"
  143. CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  144.  
  145. dnl# My test to see if OpenGL is on this machine:
  146. GLLIB=
  147. AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lGLU -lGL", \
  148.     AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGLU -lMesaGL",,\
  149.     -lX11 -lXext $X_EXTRA_LIBS -lm), \
  150.     -lX11 -lXext $X_EXTRA_LIBS -lm)
  151. AC_SUBST(GLLIB)
  152.  
  153. AC_CHECK_HEADER(X11/extensions/Xdbe.h, \
  154.     if test "$uname" != "SunOS"; then
  155.         AC_DEFINE(HAVE_XDBE)
  156.     fi)
  157.  
  158. AC_CACHE_CHECK("for X overlay visuals", ac_cv_have_overlay,
  159.     if xprop -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
  160.         ac_cv_have_overlay=yes
  161.     else
  162.         ac_cv_have_overlay=no
  163.     fi)
  164. if test "$ac_cv_have_overlay" = yes; then
  165.     AC_DEFINE(HAVE_OVERLAY)
  166. fi
  167.  
  168. MAKEDEPEND="\$(CXX) -M"
  169.  
  170. dnl# add warnings to compiler switches:
  171. dnl# do this last so messing with switches does not break tests
  172. if test -n "$GXX"; then
  173.     CFLAGS="-Wall $CFLAGS"
  174.     CXXFLAGS="-Wall -Wno-return-type $CXXFLAGS"
  175.     if test -z "$DEBUGFLAG"; then
  176.         CFLAGS="-O2 $CFLAGS"
  177.         CXXFLAGS="-O2 $CXXFLAGS"
  178.     fi
  179.     if test $PICFLAG = 1; then
  180.         CFLAGS="-fPIC $CFLAGS"
  181.         CXXFLAGS="-fPIC $CXXFLAGS"
  182.     fi
  183. else
  184.     case `(uname) 2>/dev/null` in
  185.         IRIX*)
  186.         # Running some flavor of IRIX; see which version and
  187.         # set things up according...
  188.         if test "$uversion" -ge 62; then
  189.             # We are running IRIX 6.2 or higher; uncomment the following
  190.         # lines if you don't have IDO 7.2 or higher:
  191.         #
  192.         #     CXX="CC -n32"
  193.         #     CC="cc -n32"
  194.         #     LD="ld -n32"
  195.         #     MAKEDEPEND="CC -M"
  196.  
  197.         echo "FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI -n32"
  198.             # -woff 3322 is necessary due to errors in Xlib headers on IRIX
  199.             CFLAGS="-fullwarn $CFLAGS"
  200.             CXXFLAGS="-fullwarn -woff 1685,3322 $CXXFLAGS"
  201.         else
  202.             CXXFLAGS="+w +pp $CXXFLAGS"
  203.         fi
  204.         if test -z "$DEBUGFLAG"; then
  205.             CFLAGS="-O2 $CFLAGS"
  206.             CXXFLAGS="-O2 $CXXFLAGS"
  207.         fi
  208.         ;;
  209.     HP-UX*)
  210.         # Running HP-UX; these options should work for the HP compilers.
  211.         if test -z "$DEBUGFLAG"; then
  212.         CFLAGS="+O2 $CFLAGS"
  213.         CXXFLAGS="+O2 +W336,501,736,740,749,829 $CXXFLAGS"
  214.         fi
  215.         ;;
  216.     SunOS*)
  217.         # Solaris
  218.         if test -z "$DEBUGFLAG"; then
  219.         CFLAGS="-O"
  220.         CXXFLAGS="-O"
  221.         fi
  222.         if test $PICFLAG = 1; then
  223.         CFLAGS="-KPIC $CFLAGS"
  224.         CXXFLAGS="-PIC $CXXFLAGS"
  225.         fi
  226.         ;;
  227.     *)
  228.         # Running some other operating system; inform the user they
  229.         # should contribute the necessary options to fltk-bugs@easysw.com...
  230.         echo "Building FLTK with default compiler optimizations; contact"
  231.         echo "fltk-bugs@easysw.com with uname and compiler options needed"
  232.         echo "for your platform, or set the CFLAGS and CXXFLAGS options"
  233.         echo "before running configure."
  234.         ;;
  235.     esac
  236. fi
  237.  
  238. CFLAGS="$DEBUGFLAG $CFLAGS"
  239. CXXFLAGS="$DEBUGFLAG $CXXFLAGS"
  240.  
  241. AC_SUBST(DSONAME)
  242. AC_SUBST(DSOCOMMAND)
  243. AC_SUBST(LIBNAME)
  244. AC_SUBST(LIBCOMMAND)
  245. AC_SUBST(MAKEDEPEND)
  246. AC_CONFIG_HEADER(config.h:configh.in)
  247. AC_OUTPUT(makeinclude)
  248.  
  249. dnl#
  250. dnl# End of "$Id: configure.in,v 1.33.2.5 1999/08/09 13:35:04 mike Exp $".
  251. dnl#
  252.